using Electric.API.Extensions;

var builder = WebApplication.CreateBuilder(args);

//开启日志
builder.Logging.AddLog4Net();

// 将服务添加到容器中。
builder.AddElectricControllers();

// Swagger/OpenAPI 服务
builder.AddElectricSwaggerGen();

//添加注入
builder.AddElectricService();
var app = builder.Build();

if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}
app.UseHttpsRedirection();

//允许body重用
app.Use(next =>
    context =>
    {
        context.Request.EnableBuffering();
        return next(context);
    }
);
app.MapControllers();
app.MapGet("/", () => "API");
app.Run();




